package server;

/**
 * @author Y1n
 * @date 2021/11/19 16:00
 * @decs
 **/
public abstract class HttpServlet implements Servlet{

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }


    public  abstract void doGet(Request request, Response response);

    public  abstract void doPost(Request request, Response response);

    @Override
    public void service(Request request, Response response) throws Exception {
        if("GET".equals(request.getMethod())){
            doGet(request,response);
        }else{
            doPost(request,response);
        }
    }
}
